
          <form data-bv-feedbackicons-validating="glyphicon glyphicon-refresh" data-bv-feedbackicons-invalid="glyphicon glyphicon-remove" data-bv-feedbackicons-valid="glyphicon glyphicon-ok" class="form-horizontal bv-form" method="post" id="Form" novalidate="novalidate">
        
      	<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">收货地区：</label>
               <div class="col-lg-8"> 
		<script type="text/javascript" src="{echo AURL}/js/jquery_cityselect.js"></script><script type="text/javascript" src="{echo AURL}/js/foxphp_json_city.js"></script>

            <div class="input-group" id="city_1">					  
                            <select class="prov"></select> 
                            <select class="city" disabled="disabled"></select>
                            <select class="dist" disabled="disabled"></select>
            </div>

						
						
		<script type="text/javascript">$(function(){$("#city_1").citySelect({prov:$("#ProvId").val(),city:$("#CityId").val(),dist:$("#DistId").val(),nodata:"none"});});</script>
        <input type="hidden" id="ProvId" name="provid" value="{if !empty($manage["provid"])}{echo $manage["provid"]}{else}1{/if}">
        <input type="hidden" id="CityId" name="cityid" value="{if !empty($manage["cityid"])}{echo $manage["cityid"]}{else}37{/if}">
        <input type="hidden" id="DistId" name="distid" value="{if !empty($manage["distid"])}{echo $manage["distid"]}{else}567{/if}">
               </div>
        </div>  
        
        
    	<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">收货姓名：</label>
               <div class="col-lg-5"> 
               <input type="text" name="receivename" value="{if !empty($manage['receivename'])}{echo $manage['receivename']}{/if}" class="form-control" placeholder="收货姓名">
               </div>
        </div> 
        
     	<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">联系电话：</label>
               <div class="col-lg-5"> 
               <input type="text" name="phone" value="{if !empty($manage['phone'])}{echo $manage['phone']}{/if}" class="form-control" placeholder="联系电话">
               </div>
        </div>        
        
       	<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">邮政编码：</label>
               <div class="col-lg-5"> 
               <input type="text" name="zip" value="{if !empty($manage['zip'])}{echo $manage['zip']}{/if}" class="form-control" placeholder="邮政编码">
               </div>
        </div>    
        
		<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">详细地址：</label>
               <div class="col-lg-5"> 
             	<input type="text" name="address" value="{if !empty($manage['address'])}{echo $manage['address']}{/if}" class="form-control" placeholder="详细地址">
               </div>
        </div>  
        
		<div class="form-group has-feedback">
               <label class="col-lg-2 control-label">默认地址：</label>
               <div class="col-lg-5"> 
             	 <select name="isuse" class="form-control">
                       <option value="0" {if empty($manage['isuse'])}selected="selected" {/if}>设置默认</option>
                       <option value="1" {if !empty($manage['isuse'])}{if $manage['isuse']==1} selected="selected" {/if}{/if}>使用</option>
                       <option value="2" {if !empty($manage['isuse'])}{if $manage['isuse']==2} selected="selected" {/if}{/if}>不使用</option>
                  </select>
               </div>
        </div>  

        
		<div class="form-group has-feedback">
               <div class="col-lg-offset-2 col-lg-5">
               	<button class="btn btn-success" type="submit">提 交</button>
               </div>
            </div>

          <input type="hidden" name="datatype" value="json"/>
          <input type="hidden" name="Submit" value="true"/>
          <input type="hidden" name="id" value="{echo $id}"/>
           
          </form>
          



<script src="{echo AURL}/js/validation/bootstrapValidator.js"></script>

<!--Bootstrap Date Picker-->
<script src="{echo AURL}/js/datetime/bootstrap-datepicker-{echo C('DEFAULT_LANG')}.js"></script>
<script>

        $(document).ready(function () {

 		  $('#Form').bootstrapValidator({
                excluded: [':disabled'],
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
				fields: {
					receivename: {
						validators: {
							notEmpty: {
								message: '收货姓名不能为空！'
							},
							stringLength: {
								min: 2,
								max: 20,
								message: '收货姓名最少2个字到20字内！'
							}
						}
					},
					phone: {
						validators: {
							notEmpty: {
								message: '联系电话不能为空！'
							},
							regexp: {
								regexp: /^[0-9_]+$/,
								message: '联系电话格式有误！'
							}
						}
					},
					zip: {
						validators: {
							notEmpty: {
								message: '邮政编码不能为空！'
							},
							regexp: {
								regexp: /^[0-9]+$/,
								message: '邮政编码格式有误！'
							}
						}
					},
					address: {
						validators: {
							notEmpty: {
								message: '收货地址不能为空！'
							},
							stringLength: {
								min: 2,
								max: 200,
								message: '收货地址最少2个字到200字内！'
							}
						}
					}
				},
                submitHandler: function (form) {

				  var postaction=$('input[name="id"]').val() > 0 ? 'edit' : 'insert';

				  $.post('{echo U("/post/billaddress")}/'+postaction,$("#Form").serialize(), function(json) {
					
					  	$('.bootbox').PhpappProgress({json:json});

				 		return true;
					
				  }, 'json');
				  

				 bootbox.dialog({
					 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
					 title: '<i class="icon fa fa-retweet"></i> 提交中',
					 closeButton: false
				 }).PhpappProgress({time:2000});
			 
				  return false; 
				 
                } 
			
            }) 

        });
	   

</script>
